layui.use(['tree'], function() {
    let tree = layui.tree;
    let $ = layui.$;
    // 加载菜单树
    $.ajax({
        type: 'get',
        url: config.menuUrl,
        data: {username: sessionStorage.getItem('username')},
        dataType: 'json',
        success: function(result) {
            //渲染
            var inst1 = tree.render({
                elem: '#test1'  //绑定元素
                ,isJump: true
                ,data:  result.data
                ,edit: ['add', 'update', 'del'] //操作节点的图标
                ,click: function(obj) {
                    // layer.msg(JSON.stringify(obj.data));
                    $(".layui-tree-txt").attr('target', 'mainFrame');
                }
            });
            layer.msg('请点击--控制台--测试api调用')
        },
        error: function(data) {
            alert("错误");
        }
    });
})